import { useRequest } from '@h5app/sheep/hooks'

/** 最近员工消息 */
export const RecentlyMessages = (): Promise<ApiRequest.ResultDto<any>> => {
  const request = useRequest()

  return request({
    url: '/crmH5/employeeMessage/getRecentlyMessages',
    method: 'POST',
    data: {},
  })
}

/** 消息 */
export const MessagesPage = (data: any): Promise<ApiRequest.ResultDto<any>> => {
  const request = useRequest()

  return request({
    url: '/crmH5/employeeMessage/getPage',
    method: 'POST',
    data,
  })
}

/** 设置单条消息已读 */
export const MessageReading = (id: string) => {
  const request = useRequest()

  return request({
    url: '/crmH5/employeeMessage/setRead',
    method: 'POST',
    data: { id },
  })
}

/** 设置消息全度 */
export const MessageAllReading = () => {
  const request = useRequest()

  return request({
    url: '/crmH5/employeeMessage/setAllRead',
    method: 'POST',
    data: {},
  })
}
